﻿package Classes.Weapons.Rockets{
	import flash.display.Sprite;
	import Classes.Utils.*;
	import Classes.Elements.*;
	
	public class Torpedo extends Rocket{
		private var isdrop:Boolean;

		public function Torpedo(){
			isdrop = false;
			execution = 20;
			life = 12;
			hp = 12;
			crtspeed = 1;
			speed = 9;
			acceleration = .5;
			score = UnitType.Torpedo.score;
		}
		
		override protected function move():void{
			if(!isdrop){
				if(this.sender){
					if(this.sender.hp<=0)
						isdrop = true;
				}
				else{
					isdrop = true;
				}
			}else{
				if(Math.abs(crtspeed)<Math.abs(speed)){
					crtspeed+=acceleration;
				}		
				Moving.moveBeeline(this,crtspeed,0);
			}
		}
	}
}